package com.ghh.app.monsterrush.weapons;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.ghh.app.monsterrush.MonsterRushGame;
import com.ghh.app.monsterrush.StateAction;
import com.ghh.app.monsterrush.WeaponActor;
import com.ghh.app.monsterrush.weapons.state.AttackingState;
import com.ghh.app.monsterrush.weapons.state.FlyingState;
import com.ghh.app.monsterrush.weapons.state.InitializationState;
import com.ghh.app.monsterrush.weapons.state.StandByState;

public class Shuriken extends WeaponActor {
	private final static int	power			= 30;
	private final static float	objectWidth		= 80f;
	private final static float	objectHeight	= 80f;

	private Texture				texture1;
	private Texture				texture2;
	private Texture				texture3;
	private Texture				texture4;
	private Texture				texture5;
	private Texture				texture6;

	public Shuriken(MonsterRushGame game) {
		super(game, power);
		
	}

	@Override
	protected void create() {
		Texture.setEnforcePotImages(false);
		texture1 = new Texture(Gdx.files.internal("shuriken00.png"));
		texture2 = new Texture(Gdx.files.internal("shuriken15.png"));
		texture3 = new Texture(Gdx.files.internal("shuriken30.png"));
		texture4 = new Texture(Gdx.files.internal("shuriken45.png"));
		texture5 = new Texture(Gdx.files.internal("shuriken60.png"));
		texture6 = new Texture(Gdx.files.internal("shuriken75.png"));		
	}
	
	private TextureRegion[] getFlyFrames() {
		TextureRegion[] frames = new TextureRegion[6];
		frames[0] = new TextureRegion(texture1);
		frames[1] = new TextureRegion(texture2);
		frames[2] = new TextureRegion(texture3);
		frames[3] = new TextureRegion(texture4);
		frames[4] = new TextureRegion(texture5);
		frames[5] = new TextureRegion(texture6);
		return frames;
	}
	
	@Override
	protected StateAction createStateCreate() {
		return new InitializationState(this, texture1);
	}

	@Override
	protected StateAction createStateReady() {
		return new StandByState(this, texture1);
	}

	@Override
	protected StateAction createStateFly() {
		return new FlyingState(this, getFlyFrames(), 0.03f);
	}

	@Override
	protected StateAction creatStateAttack() {
		return new AttackingState(this, texture1);
	}

	@Override
	protected float getObjectWidth() {
		return objectWidth;
	}

	@Override
	protected float getObjectHeight() {
		return objectHeight;
	}

	@Override
	public void dispose() {
		texture1.dispose();
		texture2.dispose();
	}
}
